package com.design03_behavioral.pattern19_visitor.example02;

import com.design03_behavioral.pattern19_visitor.example01.Product;
import com.design03_behavioral.pattern19_visitor.example01.Visitor;

import java.time.LocalDate;

/**
 * @ClassName 糖果类
 * @Description TODO
 * @Author 22963
 * @DATE 2023/9/10 11:28
 */
public class Candy extends Product implements Acceptable {

    public Candy(String name, LocalDate producedDate, double
            price) {
        super(name, producedDate, price);
    }

    @Override
    public void accept(Visitor visitor) {
        //accept实现方法中调用访问者并将自己 "this" 传回。
        // this是一个明确的身份,不存在任何泛型
        visitor.visit(this);
    }
}
